<?php
namespace Codeception\Module;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class AcceptanceHelper extends \Codeception\Module
{

const EMAIL_DOMAIN = 'AUTO_TEST_USER';

    public static function generateRandomString($length = 10)
    {
        return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
    }

    public static function generateEmail()
    {
        return self::generateRandomString() . '@' . self::EMAIL_DOMAIN . '.TEST';
    }

    public static function getDataThrowCurl($email)
    {
        codecept_debug($url = 'http://m.test.mainbox.com/test/activationCode?password=Zum2qX9&email=' . $email);
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_USERPWD, 'mainbox' . ":" . 'asd123');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $curl_scraped_page = curl_exec($ch);
        curl_close($ch);

        return $curl_scraped_page;
    }

}
